package org.shj.utils;

/**
 * @author Shen Huang Jian
 * @date 2020-08-31 14:15
 */
public class StringUtils extends org.apache.commons.lang3.StringUtils{

    public static String convertFieldNameToColumnName(String fieldName){
        StringBuilder sb = new StringBuilder();

        char[] chars = fieldName.toCharArray();
        for(int i = 0 ; i < chars.length; i++){
            char c = chars[i];
            if(fieldName.codePointAt(i) >= 65 && fieldName.codePointAt(i) <= 90){
                sb.append("_");
            }
            sb.append(chars[i]);
        }
        return sb.toString().toLowerCase();
    }

    public static void main(String[] args){
        System.out.println(convertFieldNameToColumnName("AaBb1Zz"));

    }
}
